import { createRouter, createWebHashHistory } from 'vue-router'
import { getIconComponent } from '../utils'

const routes = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        component: () => import('@/views/home/Layout.vue'),
        name: 'Home',
        title: '首页',
        redirect: '/home/dashboard', // 重定向到仪表盘页面
        children: [
            {
                path: 'dashboard',
                component: () => import('@/views/dashboard/Dashboard.vue'),
                name: 'Dashboard',
                title: '仪表盘',
                meta: {
                    icon: getIconComponent('DashboardOutlined'),
                    p_name: 'Home',
                }
            },
            {
                path: 'toolsManagement',
                component: () => import('@/views/tools/Tools.vue'),
                name: 'ToolsManagement',
                title: '工具管理',
                meta: {
                    icon: getIconComponent('ToolOutlined'),
                    p_name: 'Home',
                }
            },
        ]
    },
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router